package net.sareweb.acab.entity.manager;

import java.util.List;

import net.sareweb.acab.entity.City;
import net.sareweb.acab.entity.Country;
import net.sareweb.acab.entity.Request;
import net.sareweb.acab.entity.State;
import net.sareweb.acab.entity.User;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Name("cityManager")
@Scope(ScopeType.CONVERSATION)
public class CityManager extends CommonManager<City> {
	
	private final String queryFindByState="from City where state.idState=:idState";
	
	public List<City> findByState(State state){
		if(state==null) return null;
		return findByState(state.getIdState());
	} 
	public List<City> findByState(Integer idState){
		List<City> l = entityManager.createQuery(queryFindByState).setParameter("idState",idState).getResultList();
		return l;
	} 
	
}
